import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:xmshop/app/serives/screenAdapter.dart';

import '../controllers/order_controller.dart';

class OrderView extends GetView<OrderController> {
  const OrderView({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.grey[50],
        elevation: 0,
        title: const Text('订单'),
        centerTitle: true,
      ),
      body: Stack(
        children: [
          ListView(
            padding: EdgeInsets.fromLTRB(
                ScreenAdapter.width(20),
                ScreenAdapter.height(140),
                ScreenAdapter.width(20),
                ScreenAdapter.width(20)),
            children: [
              Card(
                shape: RoundedRectangleBorder(
                    side: BorderSide(color: Colors.grey[200]!),
                    borderRadius: BorderRadius.circular(10)),
                elevation: 0,
                child: InkWell(
                  onTap: () {
                    Get.toNamed("/order-info");
                  },
                  child: Column(
                    children: [
                      const ListTile(
                        title: Text("订单编号：1111xxxxxxxx"),
                      ),
                      ListTile(
                        leading: Container(
                          alignment: Alignment.center,
                          width: ScreenAdapter.width(120),
                          height: ScreenAdapter.width(120),
                          child: Image.network(
                            'https://www.itying.com/images/shouji.png',
                            fit: BoxFit.fitHeight,
                          ),
                        ),
                        title: const Text("Xiaomi 12 Pro 天玑版"),
                        trailing: const Text("x1"),
                      ),
                      ListTile(
                        leading: Container(
                          alignment: Alignment.center,
                          width: ScreenAdapter.width(120),
                          height: ScreenAdapter.width(120),
                          child: Image.network(
                            'https://www.itying.com/images/shouji.png',
                            fit: BoxFit.fitHeight,
                          ),
                        ),
                        title: const Text("Xiaomi 12 Pro 天玑版"),
                        trailing: const Text("x1"),
                      ),
                    ],
                  ),
                ),
              )
            ],
          ),
          Positioned(
              left: 0,
              right: 0,
              top: 0,
              child: Container(
                color: Colors.grey[50],
                width: ScreenAdapter.width(1080),
                height: ScreenAdapter.height(120),
                child: const Row(
                  children: [
                    Expanded(
                        child: Text(
                      "全部",
                      textAlign: TextAlign.center,
                    )),
                    Expanded(
                        child: Text(
                      "待付款",
                      textAlign: TextAlign.center,
                    )),
                    Expanded(
                        child: Text(
                      "待收货",
                      textAlign: TextAlign.center,
                    )),
                    Expanded(
                        child: Text(
                      "已完成",
                      textAlign: TextAlign.center,
                    )),
                    Expanded(
                        child: Text(
                      "已取消",
                      textAlign: TextAlign.center,
                    ))
                  ],
                ),
              ))
        ],
      ),
    );
  }
}
